//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Reflection;
using System.Windows.Data;

namespace OpenLS.Spreadsheet.UI.Internals
{
    class IsLastParameterConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var i = (ParameterInfo)value;
            var m = (MethodInfo)i.Member;
            ParameterInfo[] pp = m.GetParameters();
            return i == pp[pp.Length - 1];

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
